#pragma once

#include "state.h"

#include <string>

class Player
{
    friend class AbstractLevel;
    friend class PrimaryLevel;
    friend class SecondaryLevel;
    friend class ProfessionalLevel;
    friend class FinalLevel;

public:
    Player(const std::string &name, AbstractLevel *level) : m_level(level), m_name(name)
    {
    }

    ~Player()
    {
        if (m_level)
            delete m_level;
    }

public:
    void setLevel(AbstractLevel *level)
    {
        if (this->m_level != nullptr)
            delete this->m_level;
        this->m_level = level;
    }

    void play()
    {
        this->m_level->play(this);
    }

    void doubleScore()
    {
        this->m_level->doubleScore(this);
    }

    void changeCards()
    {
        this->m_level->changeCards(this);
    }

    void cardWriting()
    {
        this->m_level->cardWriting(this);
    }

private:
    AbstractLevel *m_level;
    std::string    m_name;
};
